// ****************************************************************************
// *     Filename:  MyHit.hh
// *  Description:  
// *      License:  Geant4 Software License 
// *                http://geant4.cern.ch/license/LICENSE.html
// *       Author:  Tran Hoai Nam (nam), nam@kuno-g.phys.sci.osaka-u.ac.jp
// * Organization:  Osaka University
// *      Created:  2012-09-14 12:57:35
// ****************************************************************************
#ifndef MYHIT_QUBW2A24
#define MYHIT_QUBW2A24

#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4THitsCollection.hh"
#include "G4ParticleDefinition.hh"
#include "G4VHit.hh"

class MyHit : public G4VHit {
	public:
		enum MyHitType {
			CaloHit,
			TrackerHit
		};
	public:
		MyHit ();
		~MyHit ();
		const MyHit& operator = (const MyHit&);
		G4int operator == (const MyHit&) const;

		inline void *operator new(size_t);
		inline void operator delete(void *aHit);
		virtual void Draw();
		virtual void Print();

		void Set_edep (G4double value) {fedep = value;}
		G4double Get_edep() { return fedep;}

		void Set_DetName (G4String value) {fDetName = value;}
		G4String Get_DetName() { return fDetName;}

		void Set_CopyNo (G4int value) {fCopyNo = value;}
		G4int Get_CopyNo() { return fCopyNo;}
	private:
		MyHitType fHitType;
		//For calo-type hit
		G4double  fedep;
		G4String	fDetName;
		G4int			fCopyNo;
		//For tracker-type hit

};

typedef G4THitsCollection<MyHit> MyHitsCollection;

extern G4Allocator<MyHit> MyHitAllocator;

inline void* MyHit::operator new(size_t)
{
	void* aHit;
	aHit = (void*)MyHitAllocator.MallocSingle();
	return aHit;
}

inline void MyHit::operator delete(void* aHit)
{
	MyHitAllocator.FreeSingle((MyHit*) aHit);
}

#endif /* end of include guard: MYHIT_QUBW2A24 */
